import { http } from '@/utils/http'
const api = '/client'
/**
 * *抽奖活动
 */
export const getRaffleApi = () => {
  const cityName = JSON.parse(uni.getStorageSync('location'))?.location?.cityName || '杭州市'
  return http({
    method: 'GET',
    url: api + '/lottery/prizeList',
    data: { cityName },
  })
}
/**
 * *抽奖活动记录
 */
export const getRaffleRecordsApi = (data: {
  lotteryId: number
  getTime: string
  pageSize: number
  pageNum: number
}) => {
  const cityName = JSON.parse(uni.getStorageSync('location'))?.location?.cityName || '杭州市'
  return http({
    method: 'POST',
    url: `${api}/lottery/lotteryRecord?lotteryId=${data.lotteryId}&getTime=${data.getTime}&pageSize=${data.pageSize}&pageNum=${data.pageNum}`,
  })
}
/**
 * *获得奖品
 */
export const getAwardApi = (data: { lotteryId: number }) => {
  const cityName = JSON.parse(uni.getStorageSync('location'))?.location?.cityName || '杭州市'
  return http({
    method: 'POST',
    url: api + '/lottery?lotteryId=' + data.lotteryId,
    // data: { ...data },
  })
}
